package com.eco.fanliapp.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.entity.AppOrderDetail;
import com.eco.fanliapp.vo.AppOrderDetailVo;
import com.eco.fanliapp.vo.MaintainOrderVo;
import com.eco.fanliapp.vo.OrderIdVo;
import com.eco.fanliapp.vo.UserVO;
import com.github.pagehelper.PageInfo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 订单 服务层
 *
 * @author xiaoxx
 * @date 2019-04-24
 */
public interface IAppOrderDetailService extends IService<AppOrderDetail> {
    /**
     * 查询订单信息
     *
     * @param orderDetailid 订单ID
     * @return 订单信息
     */
    AppOrderDetail selectAppOrderDetailById(String orderDetailid);

    /**
     * 查询订单列表
     *
     * @param appOrderDetail 订单信息
     * @return 订单集合
     */
    List<AppOrderDetail> selectAppOrderDetailList(AppOrderDetail appOrderDetail);

    /**
     * 新增订单
     *
     * @param appOrderDetail 订单信息
     * @return 结果
     */
    int insertAppOrderDetail(AppOrderDetail appOrderDetail);

    /**
     * 修改订单
     *
     * @param appOrderDetail 订单信息
     * @return 结果
     */
    int updateAppOrderDetail(AppOrderDetail appOrderDetail);

    /**
     * 删除订单信息
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    int deleteAppOrderDetailByIds(String ids);

    List<AppOrderDetail> selectAppOrderDetail(AppOrderDetail detail);

    List<AppOrderDetailVo> selectAppOrderDetailTkStatus3(Long userId, Integer tkStatus, Integer pageNum, Integer pageSize);

    List<AppOrderDetailVo> selectAppOrderDetailTkStatus13(Long userId, Integer tkStatus, Integer pageNum, Integer pageSize);

    List<AppOrderDetailVo> selectAppOrderDetailTkStatusNot3And13(Long userId, Integer tkStatus, Integer pageNum, Integer pageSize);

    List<AppOrderDetailVo> selectAppOrderDetailTkStatusAll(Long userId, Integer tkStatus, Integer pageNum, Integer pageSize);

    List<AppOrderDetailVo> selectJdOrderDetailTkStatus(Long userId, Integer tkStatus, Integer pageNum, Integer pageSize);

    List<AppOrderDetailVo> selectPddOrderDetailTkStatus(Long userId, Integer tkStatus, Integer pageNum, Integer pageSize);

    List<AppOrderDetail> selectOrderDetailItemISnull();

    List<AppOrderDetail> selectAppOrderDetailBytradeId(Long userId, Long orderId);

    /**
     * 查询订单列表
     *
     * @param
     * @param goodsPlatform
     * @param payStatus
     * @param startTime
     * @param endTime
     * @param keyWord
     * @return 订单集合
     */
    ServerResponse<PageInfo> selectAppOrderDetailList(Integer currentPage, Integer pageSize, Integer companyId, String goodsPlatform, String payStatus, String startTime, String endTime, String keyWord);

    /**
     * 根据条件模糊查询订单
     *
     * @param payStatus
     * @param startTime
     * @param endTime
     * @param keyWord
     * @return
     */
    ServerResponse<PageInfo> selectAppOrderDetailByKeyWord(String goodsPlatform, String payStatus, String startTime, String endTime, String keyWord, int currentPage, int pageSize, Integer companyId);

    /**
     * 查询我的团队下级订单
     *
     * @param relationId
     * @param specialId
     * @param tkStatus
     * @param pageNum
     * @param pageSize
     * @return
     */
    List<AppOrderDetail> findTeamLevalOrderList(Long relationId, Long specialId, Integer tkStatus, Integer pageNum, Integer pageSize);

    /**
     * 查询我的团队下下级订单
     *
     * @param relationId
     * @param specialId
     * @param tkStatus
     * @param pageNum
     * @param pageSize
     * @return
     */
    List<AppOrderDetail> findTeamLeval2OrderList(Long relationId, Long specialId, Integer tkStatus, Integer pageNum, Integer pageSize);

    int deleteAppOrderDetailById(String orderDetailid);

    /**
     * 查询所有非失效订单
     *
     * @return
     */
    List<AppOrderDetail> selectAppOrderDetailFailList();


    /**
     * 根据trade查询订单信息
     *
     * @param tradeId 订单ID
     * @return 订单信息
     */
    AppOrderDetail selectAppOrderDetailByTradeId(Long tradeId);

    /**
     * 根据userId查询当天订单数量
     *
     * @param startTodayTime
     * @param endTodayTime
     * @param userId
     * @return
     */
    int selectOrderIsTodayCount(long startTodayTime, long endTodayTime, Long userId);

    /**
     * 根据unionId查询订单数量
     *
     * @param userId
     * @return
     */
    int selectAppUserOrderCount(Long userId);

    /**
     * 设置维权订单
     *
     * @param tradeId
     * @return
     */
    ServerResponse violationsToSet(Long tradeId, UserVO authentication);

    /**
     * 0元购单数
     *
     * @param companyId
     * @param i
     * @param startTime
     * @param endTime
     * @return
     */
    int totalGoodFrees(Integer companyId, Integer i, long startTime, long endTime);

    /**
     * 昨日0元购单数
     *
     * @return
     */
    int yesterdayTotalGoodFrees();

    /**
     * 查询订单明细
     *
     * @param currentPage
     * @param pageSize
     * @param companyId
     * @param goodsPlatform
     * @param payStatus
     * @param startTime
     * @param endTime
     * @param keyWord
     * @return
     */
    ServerResponse<PageInfo> selectAppOrderDetailListNew(Integer currentPage, Integer pageSize, Integer companyId, String goodsPlatform, String payStatus, String startTime, String endTime, String keyWord, Integer deleted);

    /**
     * 根据商品详情，查询哪些订单丢失
     *
     * @return
     */
    List<AppOrderDetail> orderCheckList();

    /**
     * 根据商品详情，查询哪些订单丢失
     *
     * @return
     */
    List<AppOrderDetail> orderCheckUserOrderList();

    List<OrderIdVo> violationsToSetList(HttpServletResponse response, MultipartFile file, UserVO authentication);

    /**
     * 查询用户订单详情
     *
     * @param currentPage
     * @param pageSize
     * @param userId
     * @return
     */
    ServerResponse<PageInfo> selectAppOrderDetailListNew(int currentPage, int pageSize, Long userId);

    int deleteOrderDetail(Long orderId);

    boolean handleDetailStatus();

    List<MaintainOrderVo> maintainOrderList(HttpServletResponse response, MultipartFile file, UserVO authentication);
}
